<?php
include('top.php');
require_once('pasmy/dbwaarden.php');
if(empty($_SESSION['taal'])) {
	session_destroy();
		Header( "HTTP/1.1 301 Moved Permanently" );
		 
		Header( "Location: login.php" ); 
}
/*echo "dbhost = $dbhost<br>";*/

$mysql_id = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $mysql_id);

/*foreach($land as $key => $value) {
	echo "sleutel = $key en waarde = $value <br>";
}*/
 

if(isset($_POST["toevoegen"])) {
	//postwaarden();exit;	
	
	$nam = addslashes($_POST["naam"]); if(empty($nam)) {$nam = "&nbsp;";}
	$voornam = addslashes($_POST["voornaam"]); if(empty($voornam)) {$voornam = "&nbsp;";}
	$firm = addslashes($_POST["firma"]); if(empty($firm)) {$firm = "&nbsp;";}
	$tel = $_POST["telefoon"]; if(empty($tel)) {$tel = "&nbsp;";}
	$fax = $_POST["fax"]; if(empty($fax)) {$fax = "&nbsp;";}
	$opm = addslashes($_POST["opmerkingen"]); if(empty($opm)) {$opm = "&nbsp;";}
	$email = addslashes($_POST["email"]); if(empty($email)) {$email = "&nbsp;";}
	$lands = addslashes($_POST["landen"]); if(empty($lands)) {$lands = "&nbsp;";}
$sql = "insert into contacten (naam,voornaam,firma,tel,fax,opm,email) VALUES ('$nam','$voornam','$firm','$tel','$fax','$opm','$email')";


$res = mysql_query($sql, $mysql_id);
fout($mysql_id);
}
?>
<br><div style="text-align: center"><a href="contact.php#toevoegen" class="linkblue"><h3><?php echo $contacttoe[$taal];?></h3></a></div><br />
<table width="100%" align="center" border="1">
<tr bgcolor="lime">
<td><div style="text-align: center"><font size="3"><strong><?php echo $naam[$taal];?></strong></font></div></td>
<td><div style="text-align: center"><font size="3"><strong><?php echo $voornaam[$taal];?></strong></font></div></td>
<td><div style="text-align: center"><font size="3"><strong><?php echo $bedrijf[$taal];?></strong></font></div></td>
<td><div style="text-align: center"><font size="3"><strong>Tel</strong></font></div></td>
<td><div style="text-align: center"><font size="3"><strong>Fax</strong></font></div></td>
<td><div style="text-align: center"><font size="3"><strong>Email</strong></font></div></td>
<td><div style="text-align: center"><font size="3"><strong><?php echo $opmerkingen[$taal];?></strong></font></div></td>
<td><strong><div style="text-align: center">Update</div></strong></td>
<td><strong><div style="text-align: center">Delete</div></strong></td>
</tr>
<?php
$sql = "SELECT * FROM `contacten` ORDER by `firma`";
$res = mysql_query($sql, $mysql_id);
while ($row = mysql_fetch_row($res)) {
	echo "<tr><td class='zones3'>$row[0]</td>";
	echo "<td class='zones3'>$row[1]</td>";
	echo "<td class='zones3'>$row[2]</td>";
	echo "<td class='zones3'>$row[3]</td>";
	echo "<td class='zones3'>$row[4]</td>";
	echo "<td class='zones3'><a href=mailto:$row[6] class='email'>$row[6]</a></td>";
	echo "<td class='zones3'>$row[5]</td>";
	echo "<td class='zones3'><a href='contactwijzigen.php?record=$row[9]' class='linkblue'>Update</a></td>";
	echo "<td class='zones3'><a href='contactverwijderen.php?record=$row[9]' class='linkblue'>Delete</a></td></tr>";
	}
mysql_free_result($res);




?>
</table>
<br /><br /><br />

<div style="text-align: center"><a name="toevoegen"><h2><?php echo $contacttoe[$taal];?></h2></a></div>

<form action="contact.php" method="post">
<table>
<tr>
<td class="zones"><?php echo $naam[$taal];?></td>
<td class="zones"><input type="text" name="naam" size="25" maxlength="25" /></td>
</tr>
<tr>
<td class="zones"><?php echo $voornaam[$taal];?></td>
<td class="zones"><input type="text" name="voornaam" size="25" maxlength="25" /></td>
</tr>
<tr>
<td class="zones"><?php echo $firma[$taal];?></td>
<td class="zones"><input type="text" name="firma" size="25" maxlength="80" /></td>
</tr>
<tr>
<td class="zones">E-mail</td>
<td class="zones"><input type="text" name="email" size="25" maxlength="80" /></td>
</tr>
<tr>
<td class="zones"><?php echo $telefoon[$taal];?></td>
<td class="zones"><input type="text" name="telefoon" size="25" maxlength="25" /></td>
</tr>
<tr>
<td class="zones">Fax</td>
<td class="zones"><input type="text" name="fax" size="25" maxlength="80" /></td>
</tr>
<tr>
<td class="zones"><?php echo $opmerkingen[$taal];?></td>
<td class="zones"><textarea name="opmerkingen" rows="1" cols="40"></textarea></td>
</tr>
<tr>
<td class="zones"><?php echo $land[$taal];?></td>
<td>
 &nbsp;
</td>
</tr>
<tr>
<td colspan="2"><div style="text-align: center"><input type="submit" name="toevoegen" value="<?php echo $toevoegen[$taal];?>" /></div></td>
</tr>
</table>
</form>

<?php
include('footer.php')
?>